package LeetCode.stackvsqueue;

import java.util.Stack;

public class StackTurnQueue {
    private Stack<Integer> stack1 = new Stack<Integer>();
    private Stack<Integer> stack2 = new Stack<Integer>();

    public void push(int node){
        stack1.push(node);
        System.out.println("入队列元素是："+node);
    }


    public int pop(){
        int T ;
        while(!stack1.empty()){
            stack2.push(stack1.pop());
        }
       T = stack2.pop();
        while(!stack2.empty()){
            stack1.push(stack2.pop());
        }
        return T;
    }
}
